<!--[if ie 6]>
      <style type="text/css">
      div#content div.buttonMinibox{width:200px;display:inline;float:none;overflow: hidden;}
      div#content div.buttonBox{width:600px;height:30px;}
      </style>
<![endif]-->

<?php

	//echo $accessibility->whereIAm($pageTitle,array(array('title'=>'Entidades','link'=>'/organizations'),array('title'=>'Visualizar entidade')));
	echo $this->renderElement('message');
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	
	echo "<div id='view'>";
	if (!empty($organization['Organization']['logo'])) {
		echo $html->image('../organizations/logo/'.$organization['Organization']['id']);
	}
	echo "<p><label>Nome: </label><span>".$organization['Organization']['nome']."</span></p>";
	//echo "<p><label>Alias:</label><span>".$organization['Organization']['alias']."</span></p>";
	echo "<p><label>Endereço: </label><span>".$organization['Organization']['endereco']."</span></p>";
	echo "<p><label>Bairro: </label><span>".$organization['Organization']['bairro']."</span></p>";


	$cidade = $organization['Cidade']['nome'];
	if (isset($cidade)) $estado = $organization['Cidade']['Estado']['nome'];
	else $estado = '';
	echo "<p><label>Cidade: </label><span>".$cidade." - ".$estado."</span></p>";
	echo "<p><label>CEP: </label><span>".$organization['Organization']['cep']."</span></p>";
	echo "<p><label>Telefone: </label><span>".$organization['Organization']['telefone']."</span></p>";
	echo "<p><label>CNPJ: </label><span>".$organization['Organization']['cnpj']."</span></p>";
	echo "<p><label>Site: </label><span>".$html->link($organization['Organization']['site'],$organization['Organization']['site'],array(),null, true)."</span></p>";
	echo "<p><label>e-mail: </label><span>".$organization['Organization']['email']."</span></p>";
	echo "<p><label>Descrição: </label><span>".$organization['Organization']['descricao']."</span></p>";
	echo "<br />";

	/* Botoes - Inicio */
	$entity = 'organizations';
	$model = 'Organization';
	$label = 'entidade';
	$label_plural = 'entidades';

	echo "<div class='buttonBox'>";


	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/index/')) {
		$listButton = "<span class=\"buttonList\">Listar ".$label_plural."</span>";
		echo html_entity_decode($html->link($listButton, '/'.$entity.'/',array('class'=>'button')));
	}
	echo "</div>";

	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/edit/')) {
		$editButton = "<span class=\"buttonEdit\">Editar ".$label."</span>";
		echo html_entity_decode($html->link($editButton, '/'.$entity.'/edit/'.$organization[$model]['id'],array('class'=>'button')));
	}
	echo "</div>";

	if ($othAuth->hasPermission($entity.'/delete/')) {
		echo "<div class='buttonMinibox'>";
		if ($othAuth->hasPermission($entity.'/delete/')) {
			$deleteButton = "<span class=\"buttonDelete\">Apagar ".$label."</span>";
			echo html_entity_decode($html->link($deleteButton,'/'.$entity.'/delete/'.$organization[$model]['id'], array('class'=>'button'), 'Confirma a exclusão deste item?'));
		}
		echo "</div>";
	}
	echo "</div>";
	/* Botoes - Fim */

	echo "</div>";